package com.youma.wt.mvpbaselib;


import java.lang.ref.WeakReference;

/**
**  类名：BasePrsenter   创建目的： "基类Presenter"
**  作者：wangtong
**  时间:"2018/4/11 0011 15:35"
*/
public abstract class BasePrsenter<T extends BaseViewInterface> {

    private WeakReference<T> mActivityRef;

    public void attchActivity(T activity){
        mActivityRef = new WeakReference<>(activity);
    }
    public void dettchActivity(){
        if(mActivityRef != null){
            mActivityRef.clear();
        }
    }

    public T getMyRefActivity(){
        return mActivityRef.get();
    }

    /**
     * Fetch data.
     * 获取列表数据
     * @param isRefresh  true refresh  false loadMore
     */
    public abstract void fetchData(boolean isRefresh);

    /**
     * Fetch data.
     * 获取非列表数据
     */
    public abstract void fetchData();
}
